<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('牛档案列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <!--<li>-->
                            <!--耳号：<input type="text" name="cowCode"/>-->
                        <!--</li>-->

                        <li class="select-time">
                            <label>查询时间： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>

                        <!--<li>
                            出生年月：<input type="text" name="birthDay"/>
                        </li>

                        <li>
                            来源：1 ：自产 2：外购：<input type="text" name="comeFrom"/>
                        </li>

                        <li>
                            入舍时间：<input type="text" name="inputTime"/>
                        </li>

                        <li>
                            入舍时体重(kg)：<input type="text" name="firstWeight"/>
                        </li>

                        <li>
                            产牛胎次：<input type="text" name="childs"/>
                        </li>

                        <li>
                            淘汰时间：<input type="text" name="eliminateTime"/>
                        </li>

                        <li>
                            淘汰原因：<input type="text" name="eliminateReason"/>
                        </li>

                        <li>
                            更新时间：<input type="text" name="updateTime"/>
                        </li>

                        <li>
                            创建时间：<input type="text" name="createTime"/>
                        </li>

                        <li>
                            创建者：<input type="text" name="createBy"/>
                        </li>

                        <li>
                            备注：<input type="text" name="remark"/>
                        </li>-->

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <!--<div class="btn-group-sm" id="toolbar" role="group">-->
            <!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ncCowsFiles:add">-->
                <!--<i class="fa fa-plus"></i> 添加-->
            <!--</a>-->
            <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()"-->
               <!--shiro:hasPermission="system:ncCowsFiles:edit">-->
                <!--<i class="fa fa-edit"></i> 修改-->
            <!--</a>-->
            <!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"-->
               <!--shiro:hasPermission="system:ncCowsFiles:remove">-->
                <!--<i class="fa fa-remove"></i> 删除-->
            <!--</a>-->
            <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncCowsFiles:export">-->
                <!--<i class="fa fa-download"></i> 导出-->
            <!--</a>-->
        <!--</div>-->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
    <div class="bottom-btns"></div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncCowsFiles:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncCowsFiles:remove')}]];
    // var birthFlag = [[${@permission.hasPermi('system:ncGoods:birth')}]];
    var prefix = ctx + "system/ncCowsFiles/";

    $(function () {
        var datas = [[${@dict.getType('comeFrom')}]];
        var options = {
            url: prefix + "/frontList",
            // createUrl: prefix + "/add",
            // updateUrl: prefix + "/edit/{id}",
            // removeUrl: prefix + "/remove",
            // exportUrl: prefix + "/export",
            // birthUrl: prefix + "/birth/{id}",
            modalName: "牛档案",
            showExport: true,
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            showExport: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'cowId',
                    title: '序号',
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'cowCode',
                    title: '耳号',
                    sortable: true
                },
                {
                    field: 'birthDay',
                    title: '出生年月',
                    sortable: true
                },
                {
                    field: 'cowAge',
                    title: '牛龄',
                    sortable: true,
                    formatter: function (value, row, index) {
                        var newdate = new Date()
                        var fullYear = newdate.getFullYear();  //获取系统时间减去牛的出生日期
                        return fullYear - ((row.birthDay).substring(0,4)) ;
                    }
                },
                {
                    field: 'comeFrom',
                    title: '来源',/*：1 ：自产 2：外购*/
                    formatter: function(value, item, index) {
                        return $.table.selectDictLabel(datas,item.comeFrom);
                    }
                },
                {
                    field: 'inputTime',
                    title: '入舍时间',
                    sortable: true
                },
                {
                    field: 'firstWeight',
                    title: '入舍时体重(kg)',
                    sortable: true
                },
                {
                    field: 'childs',
                    title: '产牛胎次',
                    sortable: true
                },
                {
                    field: 'updateTime',
                    title: '更新时间',
                    sortable: true
                },
                {
                    field: 'eliminateTime',
                    title: '淘汰时间',
                    sortable: true
                },
                {
                    field: 'eliminateReason',
                    title: '淘汰原因',
                    sortable: true
                },

               /* {
                    field: 'createTime',
                    title: '创建时间',
                    sortable: true
                },*/
                /*{
                    field : 'createBy',
                    title : '创建者',
                    sortable: true
                },*/
                {
                    field: 'remark',
                    title: '备注',
                }
                // ,
                // {
                //     title: '操作',
                //     align: 'center',
                //     formatter: function (value, row, index) {
                //         var actions = [];
                //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.cowId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.cowId + '\')"><i class="fa fa-remove"></i>删除</a>');
                //         actions.push('&nbsp;<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.birthinit(\'' + row.cowId + '\')"><i class="fa fa-edit"></i>产犊信息</a> ');
                //         return actions.join('');
                //     }
                // }
                ]
        };
        $.table.init(options);

    });


setTitle("档案管理",false)
</script>
</body>
</html>